<?php
    $host = "10.9.98.136";
    $port = "3306";
    $dbname = "seven";
    $user = "dba_user";
    $passwd = "dba_user_!@#";

    $dbh = new PDO("mysql:host=$host;port=$port;dbname=$dbname",$user,$passwd);
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $dbh->exec('set names utf8');

    $sql = "SELECT id,name,sex FROM user";
    $stmt = $dbh->prepare($sql);
    $stmt->execute();

    $userResult = [];
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    $item['ID'] = $row['id'];
    $item['NAMA'] = $row['name'];
    $item['SEX'] = $row['sex'];
    $userResult[] = $item;
    }
    var_export($userResult);